#ifndef TABLEMODEL_H
#define TABLEMODEL_H

#include <QObject>
#include <QAbstractTableModel>

typedef struct FileRecord{
    bool bChecked; //是否选中
    QString strFilePath; //文件路径
}fileRecord;


class TableModel : public QAbstractTableModel
{
    Q_OBJECT
public:
    TableModel(QObject *parent=Q_NULLPTR);

    void  updateData(QList<fileRecord> recordList);//更新表格数据

    int rowCount(const QModelIndex &parent) const;//行数
    int columnCount(const QModelIndex &parent) const;//列行

    bool setData(const QModelIndex &index, const QVariant &value, int role);//设置表格项
    QVariant data(const QModelIndex &index, int role) const;
    QVariant headerData(int section, Qt::Orientation orientation, int role) const;
    Qt::ItemFlags flags(const QModelIndex &index) const;


    QList<fileRecord> m_recordList;

};

#endif // TABLEMODEL_H













